Skip to content

Conversation

@KJ7LNW
Copy link
Contributor

@KJ7LNW KJ7LNW commented Apr 10, 2025

Context

This PR addresses several terminal-related issues:

Image

Implementation

Terminal Command Delay Setting

  • Added a new configurable setting 'terminal.commandDelay' to control command execution delays in terminals
  • When set to a non-zero value, this adds a sleep delay after command execution via PROMPT_COMMAND in bash/zsh and start-sleep in PowerShell
  • The default value is 0, which disables the delay completely
  • This setting replaces the previous hardcoded delay of 50ms that was added as a workaround for VSCode bug #237208

PowerShell Counter Configuration

  • Added a new configuration option 'terminalPowershellCounter' that allows users to toggle the PowerShell counter workaround
  • This workaround adds a counter to PowerShell commands to ensure proper command execution and output capture
  • The setting is disabled by default, allowing users to enable it only when needed

ZSH EOL Mark Clearing

  • Added a new configuration option 'terminalZshClearEolMark' (default: true) that sets PROMPT_EOL_MARK='' in the terminal environment
  • This prevents issues with command output interpretation when the output ends with special characters like '%'

UI Hang Prevention

  • Fixed an issue where the UI would hang when shell integration is unavailable
  • Now properly emits a 'completed' event with a descriptive message
  • Marks the terminal as not busy and clears the active stream

Standardized Terminal Integration Timeouts

  • Replaced hardcoded 3000ms timeout with configurable Terminal.shellIntegrationTimeout in TerminalProcess.ts
  • Ensures consistent timeout behavior across all terminal integration features
  • Updated error messages to display the dynamic timeout value

How to Test

  • Test terminal command execution with different delay values
  • Test PowerShell command execution with counter enabled/disabled
  • Test ZSH command output with special characters at the end of output
  • Test terminal behavior when shell integration is unavailable
  • Test terminal behavior with different shell integration timeout values

Get in Touch

Discord: KJ7LNW

Fixes #2194
Fixes #2017


Important

This PR enhances terminal functionality by adding configurable command delays, PowerShell counter, and ZSH EOL mark clearing, while addressing UI hang issues and standardizing terminal integration timeouts.

  • Terminal Command Delay:
    • Adds terminal.commandDelay setting to control command execution delays in Terminal.ts and TerminalProcess.ts.
    • Replaces hardcoded 50ms delay with configurable delay.
  • PowerShell Counter:
    • Introduces terminalPowershellCounter setting to toggle PowerShell counter workaround in Terminal.ts and TerminalProcess.ts.
  • ZSH EOL Mark Clearing:
    • Adds terminalZshClearEolMark setting to clear ZSH EOL mark in Terminal.ts.
  • UI Hang Prevention:
    • Fixes UI hang issue by emitting 'completed' event and clearing active stream in TerminalProcess.ts.
  • Terminal Integration Timeouts:
    • Replaces hardcoded 3000ms timeout with Terminal.shellIntegrationTimeout in TerminalProcess.ts.
    • Updates error messages to reflect dynamic timeout value.
  • Settings and UI:
    • Updates SettingsView.tsx and TerminalSettings.tsx to include new terminal settings.
    • Adds translations for new settings in multiple language files.

This description was created by Ellipsis for ae0ab56. It will automatically update as commits are pushed.

Eric Wheeler added 6 commits April 10, 2025 21:18
Replace hardcoded 3000ms timeout with configurable Terminal.shellIntegrationTimeout
in TerminalProcess.ts. This ensures consistent timeout behavior across all
terminal integration features and allows users to control both timeouts through
a single setting.

The error messages are also updated to display the dynamic timeout value,
providing clearer feedback when shell integration issues occur.

Signed-off-by: Eric Wheeler <[email protected]>
When shell integration is unavailable, the UI would hang because the process
was never properly released. This change fixes the issue by:
- Emitting a 'completed' event with a descriptive message
- Marking the terminal as not busy
- Clearing the active stream
- Allowing the process to continue

Signed-off-by: Eric Wheeler <[email protected]>
Add a new configurable setting to control command execution delays in terminals.
When set to a non-zero value, this adds a sleep delay after command execution
via PROMPT_COMMAND in bash/zsh and start-sleep in PowerShell.

The default value is 0, which disables the delay completely. This setting
replaces the previous hardcoded delay of 50ms that was added as a workaround
for VSCode bug #237208.

Fixes: #2017
Signed-off-by: Eric Wheeler <[email protected]>
Add a new configuration option that allows users to toggle the PowerShell counter workaround. This workaround adds a counter to PowerShell commands to ensure proper command execution and output capture.

The setting is disabled by default, allowing users to enable it only when needed.

Signed-off-by: Eric Wheeler <[email protected]>
Added a new configuration option 'terminalZshClearEolMark' (default: true) that
sets PROMPT_EOL_MARK='' in the terminal environment. This prevents issues with
command output interpretation when the output ends with special characters like '%'.

Added translations for all supported languages.

Fixes: #2194
Signed-off-by: Eric Wheeler <[email protected]>
…egration

Added two new terminal settings:
- terminalZshOhMy: Sets ITERM_SHELL_INTEGRATION_INSTALLED=Yes for Oh My Zsh
- terminalZshP10k: Sets POWERLEVEL9K_TERM_SHELL_INTEGRATION=true for Powerlevel10k

Signed-off-by: Eric Wheeler <[email protected]>
@changeset-bot
Copy link

changeset-bot bot commented Apr 11, 2025

⚠️ No Changeset found

Latest commit: ae0ab56

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@KJ7LNW
Copy link
Contributor Author

KJ7LNW commented Apr 11, 2025

This PR looks big, but its mostly config hooks and i18n int'l. Features themselves are small if-else hooks, except for ZDOTDIR which is being tested because its a bit bigger---but still ultimately just an if-else for when the feature is enabled, otherwise no change.

Eric Wheeler added 2 commits April 11, 2025 13:09
Creates a temporary ZDOTDIR to handle zsh shell integration properly while preserving user's zsh configuration. This ensures VSCode shell integration works correctly with zsh without modifying the user's existing setup.

- Add terminalZdotdir setting (disabled by default)
- Create temporary directory with proper security (sticky bit)
- Add automatic cleanup on terminal close
- Add translations for all supported languages

User confirmed fixes:

Fixes: #2205
Fixes: #2129

Signed-off-by: Eric Wheeler <[email protected]>
Add new i18n strings for shell integration steps and expand troubleshooting text across all supported languages

Signed-off-by: Eric Wheeler <[email protected]>
@KJ7LNW
Copy link
Contributor Author

KJ7LNW commented Apr 11, 2025

@mrubens @hannesrudolph @cte,

This is a confirmed fix for at least three users, probably more. Please push and release ASAP.

@KJ7LNW KJ7LNW marked this pull request as ready for review April 11, 2025 20:40
@KJ7LNW KJ7LNW requested review from cte and mrubens as code owners April 11, 2025 20:40
@dosubot dosubot bot added size:XL This PR changes 500-999 lines, ignoring generated files. enhancement New feature or request labels Apr 11, 2025
Terminal.setTerminalZshP10k(message.bool)
}
break
case "terminalZdotdir":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For consistency with other terminal Zsh-related cases, consider renaming 'terminalZdotdir' to 'terminalZshDotdir' (or another consistent variant) unless the current naming is intentional.

},
"commandDelay": {
"label": "Terminal command delay",
"description": "Delay in milliseconds to add after command execution. The default setting of 0 disables the delay completely. This can help ensure command output is fully captured in terminals with timing issues. In most terminals it is implemented by setting `PROMPT_COMMAND='sleep N'` and Powershell appends `start-sleep` to the end of each command. Originally was workaround for VSCode bug#237208 and may not be needed."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: The description for commandDelay uses 'Powershell' instead of the proper capitalization 'PowerShell'. Please update this for consistency.

Suggested change
"description": "Delay in milliseconds to add after command execution. The default setting of 0 disables the delay completely. This can help ensure command output is fully captured in terminals with timing issues. In most terminals it is implemented by setting `PROMPT_COMMAND='sleep N'` and Powershell appends `start-sleep` to the end of each command. Originally was workaround for VSCode bug#237208 and may not be needed."
"description": "Delay in milliseconds to add after command execution. The default setting of 0 disables the delay completely. This can help ensure command output is fully captured in terminals with timing issues. In most terminals it is implemented by setting `PROMPT_COMMAND='sleep N'` and PowerShell appends `start-sleep` to the end of each command. Originally was workaround for VSCode bug#237208 and may not be needed."

Copy link
Collaborator

@mrubens mrubens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thank you!!

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 11, 2025
@mrubens mrubens merged commit 9dead72 into RooCodeInc:main Apr 11, 2025
28 checks passed
@github-project-automation github-project-automation bot moved this from PR [Pre Approval Review] to Done in Roo Code Roadmap Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request lgtm This PR has been approved by a maintainer size:XL This PR changes 500-999 lines, ignoring generated files.

Projects

None yet

2 participants